<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			img {
				width: 100px;
			}
		</style>

	</head>
	<body>
		<table border="1" id="tb">
			<tr>
				<td><img src="images/1.jpg" /></td>
				<td><img src="images/2.jpg" /></td>
				<td><img src="images/3.jpg" /></td>
			</tr>
		</table>
		<img src="images/1.jpg" id="showImg"/>
	</body>
</html>
<script>
    window.onload=function(){
        var str=document.getElementById('tb').getElementsByTagName("img");
        var showimg=document.getElementById('showImg');
             console.log(str);
        for(var i=0;i<str.length; i++){
           str[i].onclick=function(){
               showimg.src=this.src;//this是点谁就是谁不能用showimg.src=str[i].src
           }

       }

    }













</script>